{
    rules+: [
         {
            // SystemD服务崩溃
            alert: 'NodeSystemdServiceCrashed',
            annotations: {
                message: 'SystemD 服务崩溃  当前值 = {{ $value }}  LABELS: {{ $labels }}',
                summary: 'Host SystemD service crashed (instance {{ $labels.instance }})',
                runbook: $._config.runbook,
            },
            expr: |||
              node_systemd_unit_state{state="failed"} == 1
            |||,
            'for': '2m',
            labels: {
                severity: 'warning'
            },
        },
        {
            // 集群中主机内核版本不同
            alert: 'NodeKernelVersionDeviations',
            annotations: {
                message: '集群中多主机内核版本不同  当前值 = {{ $value }}  LABELS: {{ $labels }}.',
                summary: 'Host kernel version deviations (instance {{ $labels.instance }}).',
                runbook: $._config.runbook,
            },
            expr: |||
              count(sum(label_replace(node_uname_info, "kernel", "$1", "release", "([0-9]+.[0-9]+.[0-9]+).*")) by (kernel)) > 1
            |||,
            'for': '6h',
            labels: {
                severity: 'warning'
            },
        },
        {
            // 节点时间偏差
            alert: 'NodeClockSkew',
            annotations: {
                message: 'Clock skew detected. Clock is out of sync.  当前值 = {{ $value }}  LABELS: {{ $labels }}',
                summary: 'Host clock skew (instance {{ $labels.instance }})',
                runbook: $._config.runbook,
            },
            expr: |||
              (node_timex_offset_seconds > 0.05 and deriv(node_timex_offset_seconds[5m]) >= 0) or (node_timex_offset_seconds < -0.05 and deriv(node_timex_offset_seconds[5m]) <= 0)
            |||,
            'for': '2m',
            labels: {
                severity: 'warning'
            },
        },
    ],
}
